function defaultAlert(default_title,defalut_content){
	art.dialog({title:default_title,content:defalut_content,lock: true,fixed: true,ok:function(){},okValue:"确定"});
}
function okCancelAlert(default_title,defalut_content,okCallback,cancelCallback){
	art.dialog({title:default_title,content:defalut_content,lock: true,fixed: true,ok:okCallback,okValue:"确定",cancelValue:"取消",cancel:cancelCallback});
}
function callbackAlert(default_title,defalut_content,callback){
	art.dialog({title:default_title,content:defalut_content,lock: true,fixed: true,ok:callback,okValue:"确定"});
}
function user_loginout(){
	$.post("user!loginout.action",function(data){window.parent.frames.location.href="login.html";});
	
}
function pager(bean,callback){
	var prev =( bean.index ==1 ? 1: bean.index-1) ;
 	var next =( bean.index ==bean.pageCount ? bean.pageCount : bean.index+1);
    var pager ="<div class=\"message\">共<i class=\"blue\">"+bean.total+"</i>条记录，当前显示第&nbsp;<i class=\"blue\">"+bean.index+"&nbsp;</i>页</div>";
    pager+="<ul class=\"paginList\">";
    pager+="<li class=\"paginItem\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+prev+")'><span class=\"pagepre\"></span></a></li>";
    var maxShowPageCount = 5;
    var start =bean.pageCount-maxShowPageCount+1;
    if(start>bean.index){
    	start = bean.index;
    }else if (start<1){
    	start = 1;
    }
    for(var p=start,count=0;p<=bean.pageCount&&count<maxShowPageCount;p++,count++){
    	pager +="<li class=\"paginItem"+(p==bean.index ? " current" : "")+"\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+p+")'>"+p+"</a></li>";
    }
    if(bean.index+maxShowPageCount<=bean.pageCount){
    	pager+="<li class=\"paginItem more\"><a href=\"javascript:void(0)\">...</a></li>";
    	pager+="<li class=\"paginItem\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+bean.pageCount+")'>"+bean.pageCount+"</a></li>";
    }
    pager+="<li class=\"paginItem\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+next+")'><span class=\"pagenxt\"></span></a></li></ul>";

    	return pager;
	
}

function pager2(bean,pageSize,callback){
	var prev =( bean.index ==1 ? 1: bean.index-1) ;
 	var next =( bean.index ==bean.pageCount ? bean.pageCount : bean.index+1);
    var pager ="<div class=\"message\">共<i class=\"blue\">"+bean.total+"</i>条记录，每页显示<i class=\"blue\">"+pageSize+"</i>条记录，当前显示第&nbsp;<i class=\"blue\">"+bean.index+"&nbsp;</i>页</div>";
    pager+="<ul class=\"paginList\">";
    pager+="<li class=\"paginItem\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+prev+","+pageSize+")'><span class=\"pagepre\"></span></a></li>";
    var maxShowPageCount = pageSize;
    var start =bean.pageCount-maxShowPageCount+1;
    if(start>bean.index){
    	start = bean.index;
    }else if (start<1){
    	start = 1;
    }
    for(var p=start,count=0;p<=bean.pageCount&&count<maxShowPageCount;p++,count++){
    	pager +="<li class=\"paginItem"+(p==bean.index ? " current" : "")+"\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+p+","+pageSize+")'>"+p+"</a></li>";
    }
    if(bean.index+maxShowPageCount<=bean.pageCount){
    	pager+="<li class=\"paginItem more\"><a href=\"javascript:void(0)\">...</a></li>";
    	pager+="<li class=\"paginItem\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+bean.pageCount+","+pageSize+")'>"+bean.pageCount+"</a></li>";
    }
    pager+="<li class=\"paginItem\"><a href=\"javascript:void(0)\" onclick='"+callback+"("+next+","+pageSize+")'><span class=\"pagenxt\"></span></a></li></ul>";

    	return pager;
	
}


function permutate(array,permutatedArray){
	 if(!permutatedArray){
	  permutatedArray = [];
	 }
	 
	 if(array.length > 1){
	  //弹出第一个数
	  var elementCur = array.shift();
	  
	  //排列剩余的数组
	  permutate(array,permutatedArray);
	  
	  //返回剩余的数组的排列长度
	  var permutatedArrayLen = permutatedArray.length;

	  //第一个数与其他剩余数组所有数组组合
	  for(var j = 0;j < permutatedArrayLen; j++){
	   //弹出不齐的组
	   var p = permutatedArray.shift();
	   
	   //把当前元素放到排列好的数组的所有位置
	   for(var i = 0; i <= p.length; i++){
	    //复制排列好的数组
	    var r = p.slice(0);
	    
	    //插入数据到数组的位置
	    r.splice(i, 0, elementCur);
	    
	    //保存
	    permutatedArray.push(r)
	   }
	  }
	 
	  //退出条件 
	 }else{
	  permutatedArray.push([array[0]]);
	 }
	 

	 return permutatedArray;
	}